<template>
  <el-tag :type="statusType">{{ statusLabel }}</el-tag>
</template>
<script setup lang="ts">
import { computed, ref } from 'vue'
import { useLeaveCategoryStore } from '../../stores'

const leaveCategoryList = ref(useLeaveCategoryStore().getAllState())
const props = defineProps({
  status: { type: Number, default: 0 },
})

const statusLabel = computed(() => {
  return leaveCategoryList.value.find((e: any) => e.dictValue === props.status.toString())?.dictLabel || ''
  // return ''
})
const statusType = computed(() => {
  let result = 'info' // 6: 未提交, 9: 已撤销
  // 0: 已驳回, 1: 待审核, 2: 审批中, 3: 审批通过, 6: 未提交, 8: 通过后撤销, 9: 已撤销
  switch (props.status) {
    case 1:
    case 2:
      result = 'primary'
      break
    case 0:
      result = 'danger'
      break
    case 3:
      result = 'success'
      break
    case 8:
      result = 'warning'
      break
  }
  return result
})
</script>
<style lang="scss" scoped></style>
